﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace SWA_View
{
    public partial class CameraPreview : Form
    {
        string _Path = string.Empty;
        public CameraPreview(string path)
        {
            InitializeComponent();
            _Path = path;
        }

        private void CameraPreview_Load(object sender, EventArgs e)
        {
            System.Threading.Thread.Sleep(5000);
            while (File.Exists(_Path))
            {
                pictureBox1.Image = new Bitmap(File.Open(_Path, FileMode.Open, FileAccess.Read));
            }
            

        }

        //private void CameraPreview_Shown(object sender, EventArgs e)
        //{
        //    MainForm main = ((MainForm)Owner);
        //    //System.Threading.Thread.Sleep(1000);
        //    if (main.WhichCam == 1)
        //    {
        //        pictureBox1.Image = new Bitmap(File.Open(@"c:\p1_.jpg", FileMode.Open, FileAccess.Read));
        //        //pictureBox1.ImageLocation = main.PreviewPic1;
        //        pictureBox1.Update();
        //    }
        //    else if (main.WhichCam == 2)
        //    {
        //        pictureBox1.Image = new Bitmap(File.Open(@"c:\p2_.jpg", FileMode.Open, FileAccess.Read));
        //        //pictureBox1.ImageLocation = main.PreviewPic2;
        //        pictureBox1.Update();
        //    }
        //    else if (main.WhichCam == 2)
        //    {
        //        pictureBox1.Image = new Bitmap(File.Open(@"c:\p3_.jpg", FileMode.Open, FileAccess.Read));
        //        //pictureBox1.ImageLocation = main.PreviewPic2;
        //        pictureBox1.Update();
        //    }
        //}
    }
}
